package com.wash.car.biz.impl;

import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wash.car.biz.VipDetailServer;
import com.wash.car.dao.mapper.CarVipDetailMapper;
import com.wash.car.dao.model.VipDetailPageModel;
import com.wash.car.dao.model.VipDetailPageWhereModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class VipDetailServerImpl implements VipDetailServer {
    @Resource
    CarVipDetailMapper carVipDetailMapper;


    @Override
    public PageInfo<VipDetailPageModel> page(VipDetailPageWhereModel model) {
        PageHelper.startPage(model.getPageNum(), model.getPageSize(), model.getOrderBySql());
        List<VipDetailPageModel> list = carVipDetailMapper.selectPage(BeanUtil.beanToMap(model));
        PageInfo<VipDetailPageModel> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

}
